@extends('layouts.default')


@section('content')
    @if(\Illuminate\Support\Facades\Auth::check())
        <div class="row">

            <asside class="col-md-4 d-flex flex-column align-items-center">
                @include('shared._user_show',['user'=>\Illuminate\Support\Facades\Auth::user()])

                @include('shared._total',['user'=>Auth::user()])
            </asside>

            <section class="col-md-8">


                <form action="{{route('post.store')}}" method="post">
                    @csrf
                    <textarea class="form-control" name="content" rows="6">{{old("content")}}</textarea>
                    <div class="d-flex justify-content-end">
                        <button type="submit" class="btn btn-primary mt-3 btn-sm">发表</button>
                    </div>
                </form>

                <hr/>

                @if(count($userPosts) > 0)
                    <section>
                        @include('posts._posts',['posts'=> $userPosts])

                        <div class="my-3">
                            {{$userPosts->links()}}
                        </div>
                    </section>
                @else
                    <div class="text-center text-info">还没有发表内容呢~</div>
                @endif


            </section>
        </div>
    @else
        <div class="jumbotron p-3">
            <h1 class="display-4">Hello, world!</h1>
            <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
            <hr class="my-4">
            <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
            <a class="btn btn-primary btn-lg" href="{{route('users.create')}}" role="button">注册用户</a>
        </div>
    @endif
@stop
